﻿@using CodeCamp.Models.Shared
@using CodeCamp.Models.Presenters
@using CodeCamp.Infrastructure.Extensions
@model PresentersListViewModel
@{
    @* ViewBag.RegistrationUrl set in code - SetSharedViewBagProperties *@
    ViewBag.Title = "";
    if ((@Model != null) && (@Model.EventDisplayName != null))
    {
        ViewBag.Title = @Html.Encode(@Model.EventDisplayName + " | Presenters");
    }
    else
    {
        ViewBag.Title = "Code Camp | Presenters";
    }
}

@section headaddon {
<style>
    p.presenter-bio
    {
        margin-top: 0;
    }
</style>
}
    <h1 class="title">Presenters at @Model.EventDisplayName</h1>
    <h3>@Model.EventStartDate.ToLongDateString()</h3>

@if (!Model.ScheduleIsPublic && !Model.SubmissionsOpen && (Model.SubmissionsOpenDate > DateTime.Now))
{
    <text>&nbsp;<br /></text>
    <h3>Session Submissions Open @Model.SubmissionsOpenDate.ToString("ddd, MMM dd, yyyy")</h3>
    <p>To get an idea of what to expect, check out what happened at 
        @Html.ActionLink("other Boston Code Camps", "OtherCCEvents", "Home", new { eventName = @Model.EventShortName }, null).</p>
}
else
{
    <p>@Html.Encode(@Model.Presenters.Count) people have signed up as presenters to date.</p>

    <div class="presenters">
    @if (!User.IsInRole(CCRoles.RoleNames.BigCheeze) && !User.IsInRole(CCRoles.RoleNames.EventContentEditor)
         && !User.IsInRole(CCRoles.RoleNames.EventTrackLead) && !Model.PresentersArePublic)
    {
        <p>The list of presenters will appear here after session selections have been made.</p>
    }
    else
    {
      if (!Model.PresentersArePublic)
      {
          <h3>Presenters are NOT yet public</h3>
          if (Model.ShowCancelledSessions)
          {
              <h4>Sessions with status (e.g. [Cancelled]) will not show to public</h4>
              <h4>Presenter with no public sessions will not show to public</h4>
          }
      }  
      else
      {
          if (Model.ShowCancelledSessions)
          {
              <h4>Sessions with status (e.g. [Cancelled]) will not show to public</h4>
              <h4>Presenter with no public sessions will not show to public</h4>
          }
      }
      foreach (PresentersListViewModel.Presenter presenter in @Model.Presenters)
      {
        <div class="presenter-container">
            @Html.Partial("PresenterLinkHeader", presenter)
            <div>
            <h4>Sessions</h4>
            <ul>
            @foreach (var session in presenter.Sessions)
            {
                <li class="presenterSession">@Html.ActionLink(session.Title, "Details", "Sessions", new { id = @session.SessionId }, null)</li>
            }
            </ul> 
            <p class="presenter-bio">
            @if (string.IsNullOrWhiteSpace(presenter.Biography))
            {
                <text>&nbsp;</text>
            }
            else
            {
                if (presenter.Biography.Length <= 400)
                {
                @Html.Raw(@Html.Encode(presenter.Biography).Replace(Environment.NewLine, "<br/>"))
                }
                else
                {
                @Html.Raw(@Html.Encode(presenter.Biography.TruncateWithElipses(400)).Replace(Environment.NewLine, "<br/>"))
                <text>&nbsp;</text>@Html.ActionLink("more", "Details", new { id = presenter.PresenterId })
                }
            }
            </p>
            </div>
            
        </div>
      }
    }
    </div>
}


@section sidebar {
    @Html.Partial("SidebarCommonPartial")
}
